home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / incoming / jstools-.6v3 / jstools- / jstools-tk3.6v3.0 / lib / jtextbasic.tcl < prev    next >
Encoding:
Text File  |  1995-02-05  |  2.0 KB  |  70 lines

  1. # jtextbasic.tcl - support for basic Text bindings
  2. # Copyright 1992-1994 by Jay Sekora.  All rights reserved, except 
  3. # that this file may be freely redistributed in whole or in part 
  4. # for non-profit, noncommercial use.
  5.  
  6. ######################################################################
  7. # NOTE: the "jtextemacs.tcl" and "jtextvi.tcl" libraries contain actual
  8. #       procedures for emulation-specific actions.  "basic" bindings,
  9. #       however, don't use anything that isn't general (and therefore
  10. #       in jbindtext.tcl), so this file just has j:tb:basic_init in it.
  11. ######################################################################
  12.  
  13. ######################################################################
  14. # j:tb:basic_init t - set basic bindings up for widget $t (possibly "Text")
  15. ######################################################################
  16.  
  17. proc j:tb:basic_init { {t Text} } {
  18.   global j_teb
  19.   set j_teb(cutbuffer) {}
  20.   set j_teb(dragscroll,txnd) 0
  21.   set j_teb(dragscroll,delay) 50
  22.   set j_teb(scanpaste_time) 0
  23.   set j_teb(scanpaste_paste) 1
  24.  
  25.   set j_teb(keymap,$t) basic
  26.   
  27.   # in tk4, we need to make sure tkTextBind is called _before_
  28.   #   j:tb:key_bind!
  29.   j:tk4 {tkTextBind Enter}
  30.   
  31.   j:tb:key_bind $t
  32.   j:tb:mouse_bind $t
  33.   
  34.   j:tkb:mkmap Text basic basic {
  35.     {Control-slash        j:tb:select_all}
  36.     {Control-backslash        j:tb:clear_selection}
  37.     
  38.     {Delete            j:tkb:delete_left}
  39.     {BackSpace            j:tkb:delete_left}
  40.     {Return            j:tkb:insert_newline}
  41.     
  42.     {Up                j:tkb:up}
  43.     {Down            j:tkb:down}
  44.     {Left            j:tkb:left}
  45.     {Right            j:tkb:right}
  46.     
  47.     {Home            j:tkb:bol}
  48.     {End            j:tkb:eol}
  49.     
  50.     {Next            j:tkb:scroll_down}
  51.     {Prior            j:tkb:scroll_up}
  52.     
  53.     {Control-v            j:tkb:paste_selection}
  54.     {Control-i            j:tkb:self_insert}
  55.     {Control-j            j:tkb:self_insert}
  56.     {Control-h            j:tkb:delete_left}
  57.     
  58.     {Control-DEFAULT        j:tb:beep}
  59.     {DEFAULT            j:tkb:self_insert}
  60.     {Shift-DEFAULT        j:tkb:self_insert}
  61.   }
  62. }
  63.  
  64. # deprecated alias for backwards-compatibility:
  65.  
  66. proc j:tb:basic_bind { W } {
  67.   j:tb:basic_init $W
  68. }
  69.